<?php

namespace App\Admin\Actions\Auction;

use App\Models\AuctionModel;
use App\Models\AuctionOrderModel;
use Encore\Admin\Actions\RowAction;

class AuctionBidRecordAction extends RowAction
{
    public $name = '竞价记录';

    public function handle(AuctionModel|AuctionOrderModel $model)
    {
        if ($model->getTable() === 'auction') {
            return $this->response()->redirect('/admin/auctionBid?auctionId=' . $model->id . '&title=' . $model->title);
        } else {
            return $this->response()->redirect('/admin/auctionBid?auctionId=' . $model->auctionInfo->id . '&title=' . $model->auctionInfo->title);
        }
    }
}
